import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router';
import * as packages from './__routes__';

let packageRoutes = [];
for (let module of (Object.values(packages))) {
  if (module.default) {
    packageRoutes.push(...module.default);
  }
}
const routes: Array<RouteRecordRaw> = [
  ...packageRoutes,
  {
    path: '/**',
    redirect: ''
  }
];

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes
});

export default router;
